import request from '@/utils/request'

// 查询产品分类列表
export function listBizProductCategory (query, id, expandLevel) {
  if (id == null || id === '') {
    id = '0'
  }
  if (expandLevel == null || expandLevel === '') {
    expandLevel = '1'
  }
  return request({
    url: '/biz/bizProductCategory/list/' + expandLevel + '/' + id,
    method: 'get',
    params: query
  })
}

// 查询产品分类树结构
export function listTree (id, expandLevel) {
	if (id == null || id === '') {
		id = '0'
	}
  if (expandLevel == null || expandLevel === '') {
    expandLevel = '1'
  }
  return request({
    url: '/biz/bizProductCategory/listTree/' + expandLevel + '/' + id,
    method: 'get'
  })
}

// 查询产品分类树结构（排除当前节点及子节点）
export function listTreeExcludeChild (id, expandLevel) {
  return request({
    url: '/biz/bizProductCategory/listTreeExcludeChild/' + expandLevel + '/0/' + id,
    method: 'get'
  })
}

// 查询产品分类详细
export function getBizProductCategory (id) {
  return request({
    url: '/biz/bizProductCategory/' + id,
    method: 'get'
  })
}

// 查询产品分类下拉结构
export function treeGridSelect (id, expandLevel) {
  if (id == null || id === '') {
    id = '0'
  }
  if (expandLevel == null || expandLevel === '') {
    expandLevel = '1'
  }
  return request({
    url: '/system/menu/treeGridSelect/' + expandLevel + '/' + id,
    method: 'get'
  })
}

// 新增产品分类
export function addBizProductCategory (data) {
  return request({
    url: '/biz/bizProductCategory',
    method: 'post',
    data: data
  })
}

// 修改产品分类
export function updateBizProductCategory (data) {
  return request({
    url: '/biz/bizProductCategory',
    method: 'put',
    data: data
  })
}

// 删除产品分类
export function delBizProductCategory (id) {
  return request({
    url: '/biz/bizProductCategory/' + id,
    method: 'delete'
  })
}

// 查询最大编号
export function findMaxSort (parentId) {
  return request({
    url: '/biz/bizProductCategory/findMaxSort/' + parentId,
    method: 'get'
  })
}

// 获取初始化数据
export function getInitData (dictTypes) {
  return request({
    url: '/biz/bizProductCategory/getInitData/' + dictTypes,
    method: 'get'
  })
}

// 树表格检索
export function searchBizProductCategoryList (searchInfo) {
  return request({
    url: '/biz/bizProductCategory/searchBizProductCategoryList',
    method: 'get',
    params: searchInfo
  })
}

// 树检索
export function searchBizProductCategory (searchInfo) {
  return request({
    url: '/biz/bizProductCategory/searchBizProductCategory',
    method: 'get',
    params: searchInfo
  })
}
